package dy

import (
	"context"
	v1 "dy_spider/api/dy/v1"
	"dy_spider/internal/dao"
)

func (s *sDy) PostMsg(ctx context.Context, req *v1.PostMsgReq) (res *v1.PostMsgRes, err error) {
	data := map[string]string{
		"msg_id":    req.MsgId,
		"live_id":   req.LiveId,
		"user_id":   req.UserId,
		"nick_name": req.NickName,
		"content":   req.Content,
		"msg_type":  req.MsgType,
		"room_id":   req.RoomId,
	}
	_, err = dao.DyMsg.Ctx(ctx).Save(data)
	if err != nil {
		return nil, err
	}
	return res, nil
}
